package ChinaOfResponsibility.pattern.demo;

/**
 * Created by 逸足天涯 on 10/19/2019.
 */
public class EmailErrorHandler implements  IReceiver {
    private IReceiver _nextReceiver;
    public EmailErrorHandler(IReceiver nextReceiver){
        _nextReceiver = nextReceiver;
    }
    @Override
    public Boolean processMessage(Message msg) {
        if (msg.text.contains("Email")){
            System.out.println("EmailErrorHandler process " + msg.priority +
                    "priority issue :" + msg.text);
            return true;
        }else {
            if (_nextReceiver != null ){
                _nextReceiver.processMessage(msg);
            }
        }
        return false;
    }
}
